<template>
    <div class="chat">
        <Space :size="0">
            <Badge class="badge" status="success" />
            <Badge status="error" />
            <Badge status="purple" />
        </Space>
        <div class="chat-box">
            <div class="chat-sidebar">
                <!--头像-->
                <div class="avatar-box">
                    <img class="avatar" :src="src">
                </div>

                <!--图标库-->
                <div class="icons-home">
                    <div class="icons-box" tabIndex="1" v-for="icon in iconsList">
                        <img :src="icon.src" class="icons">
                        <div class="icon-name">{{ icon.name }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useUserInfo } from '@/store/userInfo';
const src = ref(new URL(`../../assets/avatars/${useUserInfo().user.avatar}`,import.meta.url).href)

// console.log(src.value);


const iconsList = ref([
    {   name: 'Msg',
        src: 'https://img2.imgtp.com/2024/05/16/p5MZYvv1.svg'
    },
    {
        name: 'Friend',
        src: 'https://img2.imgtp.com/2024/05/16/QQIkTYlj.svg'
    },
    {
        name: 'Circle',
        src: 'https://img2.imgtp.com/2024/05/16/1Yopom7P.svg'
    }
])

</script>
<style scoped>
.chat {
    border: 0px red solid;
    height: 630px;
    width: 980px;
    margin: 70px 350px;
    border-radius: 25px;
    background: #409EFF;
}

.badge {
    margin-left: 15px;
}

.chat-box {
    display: flex;
    border: 0px red solid;
    height: 600px;
    width: 950px;
    margin: auto;
    padding: 15px;
    border-radius: 25px;
    background: white;
}

.chat-sidebar {
    border: 1px red solid;
    height: 570px;
    width: 45px;
    background: #f1f0f0;
}

.avatar-box {
    width: 35px;
    height: 35px;
    clear: both;
    display: block;
    margin: auto;
}

.avatar-box :hover {
    cursor: pointer;
    transform: scale(1.2);
    transition: all 400ms linear;
}

.avatar {
    height: 35px;
    width: 35px;
    border-radius: 10px;

}

.icons-home {
    border: 1px red solid;
    height: 470px;
    margin-top: 30px;
}

.icons-box {
    border: 0px red solid;
    margin-top: 15px;
    padding-top: 10px;
    width: 40px;
    height: 55px;
    font-size: 12px;
}

.icon-name {
    width: 40px;
    text-align: center
}

.icons-box:hover, .icons-box:focus {
    border-radius: 10px;
    border-left: 2px #409EFF solid;
    box-shadow: inset 40px 0px rgba(0, 0, 255, 0.1);
    cursor: pointer;
    color: #0511e9;
}

.icons {
    margin-left: 8px;
    width: 25px;
    height: 25px;
}

.icons:hover {
    transform: scale(1.2);
    cursor: pointer;
    transition: all 300ms linear;
}
</style>